﻿using AutoMapper;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Workflow.Application.DTOs.Input;
using Workflow.Application.DTOs.Output;
using Workflow.Application.ErrorCode;
using Workflow.Application.DTOs.Input;
using Workflow.Application.ErrorCode;
using Workflow.Application.Step;
using Workflow.Domain.Enums;
using Workflow.Domain.Models;
using WorkflowCore.Models.DefinitionStorage.v1;
using WorkflowCore.Services;
using WorkflowCore.Services.DefinitionStorage;
using Yitter.IdGenerator;

namespace Workflow.Application.IService
{
    public interface IWorkflowService
    {
        /// <summary>
        /// 流程模板添加
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public Task<ApiResult<int>> AddDefinition(WorkflowDefinitionAddInput input);
        /// <summary>
        /// 流程注册
        /// </summary>
        /// <param name="model"></param>
        public void LoadDefinition(WorkflowDefinitionModel model);
        /// <summary>
        /// 流程发起
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public Task<ApiResult<int>> StartWorkflow(WorkflowStartInput input);
        /// <summary>
        /// 审批
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public Task<ApiResult<int>> Audit(AuditInput input);
        /// <summary>
        /// 获取流程模板列表
        /// </summary>
        /// <param name="input">查询参数，包含分页、标题和分组条件</param>
        /// <returns>流程模板列表</returns>
        Task<List<WorkflowDefinitionDto>> GetDefinitions(GetWorkflowInput input);

        /// <summary>
        /// 获取我的待办任务
        /// </summary>
        /// <param name="input">查询参数，包含分页、流程标题、模板组、申请人和创建时间范围</param>
        /// <returns>待办任务列表</returns>
        Task<ApiPaging<MyTaskDto>> GetMyTasks(GetMyTasksInput input);

        /// <summary>
        /// 获取流程业务实例列表
        /// </summary>
        /// <param name="input">查询参数，包含分页、流程标题、申请人和创建时间范围</param>
        /// <returns>流程业务实例列表</returns>
        Task<ApiPaging<WorkflowInstanceDto>> GetWorkflowInstances(GetWorkflowInstanceInput input);

        /// <summary>
        /// 获取流程详情
        /// </summary>
        /// <param name="input">查询参数，包含流程实例ID</param>
        /// <returns>流程详情，包括基本信息、表单数据和审批记录</returns>
        Task<ApiResult<WorkflowDetailDto>> GetWorkflowDetail(GetWorkflowDetailInput input);
    }
}
